﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using DreamCube.Foundation.Basic.Utility;

namespace AutoCompile.UI
{
    /// <summary>
    /// 编译帮助类
    /// </summary>
    public static class CompileHelper
    {
        /// <summary>
        /// 编译项目文件
        /// </summary>
        /// <param name="devenvPath"></param>
        /// <param name="projectPath"></param>
        public static void Compile(String devenvPath, ProjectElement projectElement)
        {
            //devenv solutionfile.sln /build [ solutionconfig ] [ /project projectnameorfile 
            //[ /projectsconfig name ] ]
            String commandTextTemplate = "{0} {1} /rebuild \"{2}|{3}\"";
            String commandText = String.Format(commandTextTemplate, devenvPath, projectElement.ProjectPath, projectElement.Config, projectElement.Platform);
            MyCMD.RunCmd(new String[] { commandText });
        }
    }
}
